{% import 'macro.html.twig' as web_macro %}
<table class="table table-striped table-hover" id="quiz-table">
  <thead>
  <tr>
    <th><input type="checkbox" autocomplete="off" class="js-select-all"></th>
    <th width="20%">{{ 'course.testpaper_manage.name'|trans }}</th>
    <th>{{ 'course.testpaper_manage.status'|trans }}</th>
    <th>{{ 'course.testpaper_manage.statistics'|trans }}</th>
    <th >{{ 'course.testpaper_manage.update'|trans }}</th>
  </tr>
  </thead>
  <tbody>
  {% for testpaper in testpapers %}
    {% set user = users[testpaper.updated_user_id] %}
    <tr data-role='item'>
      <td><input value="{{ testpaper.id }}" type="checkbox" class="js-checkbox" data-id="{{ testpaper.id }}"></td>
      <td>
        <a class="link-primary" href="{{ path('question_bank_manage_testpaper_preview', {id: questionBank.id, assessmentId: testpaper.id}) }}" target="_blank">{{ testpaper.name|plain_text(40) }}</a>
      </td>
      <td>
        {% if testpaper.status == 'draft' %}{{'course.testpaper_manage.testpaper_status.draft'|trans}}{% endif %}
        {% if testpaper.status == 'open' %}{{'course.testpaper_manage.testpaper_status.open'|trans}}{% endif %}
        {% if testpaper.status == 'closed' %}{{'course.testpaper_manage.testpaper_status.closed'|trans}}{% endif %}
      </td>
      <td>
        {{'course.testpaper_manage.count'|trans({'%itemCount%': testpaper.item_count})}} <span class="color-gray">/</span> {{'course.testpaper_manage.score'|trans({'%score%': testpaper.total_score})}}
      </td>
      <td>
        {{ web_macro.user_link(user) }}
        <br />
        <span class="color-gray text-sm">{{testpaper.updated_time | date('Y-n-d H:i:s')}}</span>
      </td>
    </tr>
  {% else %}
    <tr>
      <td colspan="20">
        {% if isSearch is defined %}
          <div class="empty">{{ 'my.teaching.question_bank.testpaper.empty'|trans }}</div>
        {% else %}
          {{ 'course.testpaper_manage.empty'|trans({'%createUrl%':path('question_bank_manage_testpaper_list', {id: questionBank.id})})|raw }}
        {% endif %}
      </td>
    </tr>
  {% endfor %}
  </tbody>
</table>
<div>
  <label class="checkbox-inline"><input type="checkbox" autocomplete="off" class="js-select-all"> {{'course.question_manage.select_all'|trans}}</label>
  <span class="color-gray mlm vertical-middle">{{ 'my.teaching.question_bank.question.selected'|trans }}：<span class="js-select-number">0</span></span>
  <button id="batch-add" class="cd-btn cd-btn-default cd-btn-sm mlm" style="float: right" data-name="{{ 'course.testpaper_manage.testpaper'|trans }}" data-url="{{ path('item_bank_exercise_manage_add_assessment', {exerciseId: exercise.id, moduleId: moduleId}) }}">
    {{ 'form.field.create'|trans }}
  </button>
</div>

{{ web_macro.ajax_paginator(paginator) }}
